<%--
 *  File:    CountryCode.jsp
 *  @Author: Morgan Li
 *  Date:    5/7/2002
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%
  Category cat = Category.getInstance("jsp.CountryCode");  
  String strTableName = "jpovcountry";
  String strModuleName = "IMG";
  String privilegeCode = "Z0805";
%>



<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<%int LangNums = ConstantProp.multiLangNumber;%>

<html>
<head>
<title>CountryCode</title>
<PageFlow:CheckPageFlow pageName="countrycode"/>
<%@ include file="/inc/SumDiv.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script language="JavaScript" src="../js/SummaryDivision.js"></script>
<script language="JavaScript">

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(document.thisform, actionvalue, orderbyname);
  if (editform == false)
      return;
  editform.action = "CountryCode.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_codechange()
{
  for(var i=1;i<Number(thisform.nums.value)+1;i++)
  {
    var obj=eval("thisform.countrycodes"+i);
    var obj1=eval("thisform.countrycodetemp");
    obj.value=Trim(obj.value);
    obj1.value=Trim(obj1.value);
    if(obj.value==obj1.value)
    {
      alert('<%=message.getMessageDesc("COUNTRYCODE_HAS_EXIST")%>');
      thisform.countrycodetemp.value="";
      return;
    }
  }
}

function page_add()
{

  if(!checkForm(thisform)) return;
  page_copydesc();
  thisform.actionname.value = "add";
  thisform.target = "_self";
  isRunning = true;
  thisform.submit();
}
function page_save()
{
  thisform.actionname.value = "save";
  thisform.target = "_self";
  isRunning = true;
  thisform.submit();
}
function page_delete()
{
  if(isNullChecked(thisform.countrycodes)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  thisform.actionname.value = "delete";
  thisform.target = "_self";
  isRunning = true;
  thisform.submit();
}


function page_mulilang(columnname,label,num,need,entitycode)
{
  if(popwindow!=null)
    popwindow.close();
  var strurl="../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=thisform&module=IMG&mlctype="+label+"&nativelanguage="+need+"&schema=v_ovcountryforjp&qlname=selectbycode&entitytype="+columnname+"&contentid=countryid&entitycode="+entitycode+"&colindex="+num;
  var strStatus= "height=250, width=250,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  popwindow=window.open(strurl, "newwindow",strStatus);
}   	
    
function page_copydesc()
{
  for(var i=0;i< <%=LangNums%>;i++)
  {
    var obj0=eval("thisform.fullname"+i);
    if(obj0.value != "")
    var objtemp=obj0.value;
  }
  for(var i=0;i< <%=LangNums%>;i++)
  {
    var obj=eval("thisform.countrycode"+i);
    var obj1=eval("thisform.fullname"+i);
    obj.value=thisform.countrycodetemp.value;
    if(obj1.value == "")
    obj1.value=objtemp;
  }
}

<%--[SCRIPT]    [SCRIPT]--%>
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="thisform" method="post" action="../Dispatcher">
	<input type="hidden" name="pagename" value="countrycode">
    <input type="hidden" name="actionname">
    <input type="hidden" name="nullstring">
    <input type="hidden" name="pageaction">
    <input type="hidden" name="orderbycolumn" value="<%=JspHelper.filterNull( strCurOrderByCol )%>">
    <input type="hidden" name="orderbytype" value="<%=JspHelper.filterNull( strCurOrderByType )%>">
    <%@ include file="/inc/PageLocation.inc" %>
<table width="100%" border="0" cellspacing="0">
  <tr> 
    <td class="summary_top" colspan="2" ></td>
  </tr>
  <%@ include file="/inc/SummarySearch.inc" %>  
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tr> 
    <td> 
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left" > 
          <td width="22" class="title_center">&nbsp;</td>
          <td width="80" class="title_center" ><%= label.getLabelName("L_CounrtyCode") %></td>
          <td class="title_center" width="150"><%= label.getLabelName("L_Name") %></td>
        </tr>
		<%
		    Vector countrysummary=(Vector)pageContext.getAttribute("countrysummary");
		    if(countrysummary==null)
		    {
		        countrysummary=new Vector();
		    }
		   
		    int i=1;
		    String strClassType="";
		    cat.debug("countrysummary is :"+countrysummary);
		%>
        <logic:iterate id="countrysummaryitem" collection="<%= countrysummary %>">
        <%
            Integer oColIndexLang=new Integer(i);
            if(i%2 == 0)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            i++;
        %>
         	
        <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>"> 
            <td class="none"> 
            <input type="checkbox" name="countrycodes" id="countrycodes<%=JspHelper.filterNull(i-1)%>" value="<custom:write name="countrysummaryitem" property="countrycode"/>" class="normalradio">
            </td>
            <td>&nbsp;<custom:write name="countrysummaryitem" property="countrycode"/></td>
            <td>&nbsp;
            <custom:text name="countrysummaryitem" command="notnull" module="IMG" label="L_Name" size="40" colIndex="<%=oColIndexLang%>" property="fullname" module="IMG" isFirstMLC="true" multiLangType="fullname" entityId="countrycode" contentId="countryid"  needMLC="true"  />
            <a onclick="page_mulilang('fullname','L_Name','<%=oColIndexLang%>','need','<custom:write name="countrysummaryitem" property="countrycode" />');"><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a> 
            </td>
          </tr>
          
        </logic:iterate>
        <input type=hidden name=nums value="<%=JspHelper.filterNull(countrysummary.size())%>">
        <input type=hidden name=numrows value="<%=LangNums*(JspHelper.filterNull(countrysummary.size())+1)%>">

        <tr class="none"> 
          <td>&nbsp; </td>
          <td> 
            <input type="text" name="countrycodetemp" dataType="vchar" command="notnull" label="<%=label.getLabelName("L_CounrtyCode",false)%>" module="IMG" size="20" onblur="javascript:page_codechange();">
            <span class="red">*</span> </td>
          <td> 
            <custom:text command="notnull" module="IMG" label="L_Name" size="40"  property="fullname" module="IMG" isFirstMLC="true" multiLangType="fullname" entityId="countrycode" contentId="countryid" needMLC="true" onchange="javascript:page_copydesc();" />
            <a onclick="page_mulilang('fullname','L_Name','0','need','-1');"><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a> 
            </td>
          
        </tr>
      
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
        <tr> 
          <td class="td_center">
          <a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
          <a onclick="page_save()"><custom:button type="1" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>


